import Http.httpclient.HttpClient;
import Http.httpclient.HttpClientConfig;
import Http.httpclient.HttpClientUtil;
import cn.hutool.http.HttpUtil;
import lombok.SneakyThrows;
import org.apache.commons.collections4.map.HashedMap;
import org.apache.http.impl.client.BasicCookieStore;

import java.util.Map;

/**
 * @Author: 葛成瑞
 * @Date: 2025/6/14 9:30
 */
public class TestHttpProxy {
    @SneakyThrows
    public static void main(String[] args) {


        String doiParam = "10.1097/MD.0000000000014617";
        // 要么返回空 要么返回404 要么返回真实地址
        String s = postDoiUrl(doiParam);
        System.out.println(s);
    }


    @SneakyThrows
    public static String postDoiUrl(String doiParam) {
        String res = "";
        try {
            String doi = "https://dx.doi.org/";
            Map<String, String> map = new HashedMap();
            map.put("hdl", doiParam);
            res = HttpClient.postDirect302Url(doi, map);
        } catch (Exception e) {

        }

        return res;
    }
}
